//
//  GoodsEditViewController.m
//  Assistant
//
//  Created by liaozhenming on 16/6/7.
//  Copyright © 2016年 liaozhenming. All rights reserved.
//

#import "GoodsEditViewController.h"

@interface GoodsEditViewController () <UITextFieldDelegate>

@end

@implementation GoodsEditViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [_nameField setKk_keyboardEvent: YES];
    [_buyingPriceField setKk_keyboardEvent: YES];
    [_priceField setKk_keyboardEvent: YES];
    [_stockField setKk_keyboardEvent: YES];
    
    [_pannelView kk_cornerRadius: 2];
    [_btn_continue kk_cornerRadius: 3];
    [_btn_save kk_cornerRadius: 3];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear: animated];
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear: animated];
    self.tabBarController.tabBar.hidden = NO;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Action methods

- (IBAction)action_continue:(id)sender {
    
}

- (IBAction)action_save:(id)sender {
    [self.navigationController popViewControllerAnimated: YES];
}

#pragma mark - UITextFieldDelegate methods
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    
    if (textField == _nameField) {
        [_buyingPriceField becomeFirstResponder];
    }
    else if (textField == _buyingPriceField) {
        [_priceField becomeFirstResponder];
    }
    else if (textField == _priceField){
        [_stockField becomeFirstResponder];
    }
    else {
        [textField resignFirstResponder];
    }
    return YES;
}


@end
